package cn.yudao.ymcc.validannotion;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Pattern;
import java.lang.annotation.*;

/**
* @Title:
* @Description: 自定义JSR303校验规则的注解
* @Author: Mr.Jia
* @Version: 1.0
* @Date:  2022/8/5 14:40
* @Parameters:
* @Return
*/
@Documented
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME) // 注解保留时间-- runtime表示不仅被保存到class文件中，jvm加载class文件之后，仍然存在
@Constraint(validatedBy = ValidPhone.class) // 表明业务实现的类是什么 实现类需要继承ConstraintValidator<phone,Object>
public @interface phone {

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String regexp() default ".*";

    String message();

    Pattern.Flag[] flags() default {};
}
